<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:set var="root" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>闲情偶寄|分类</title>
<jsp:include page="../common/head.jsp" flush="true" />

</head>

<body>
	<jsp:include page="../common/left.jsp" flush="true" />
	<div class="right">
		<jsp:include page="../common/header.jsp" flush="true" />
		<header class="content-header">
			<div class="content-header-container">
				<h1>分类</h1>
				<div class="title-list">
					<ul>
						<li><a class="title-href index" href="${root}/category">全部</a></li>
						<c:forEach items="${allCategories }" var="category">
							<li><a href="${root }/category?categoryId=${category.id}" class="title-href">${category.name }</a></li>
						</c:forEach>
					</ul>
				</div>
			</div>
		</header>
		<div class="main">
			<c:if test="${!empty num}">
				<center><h2>木有</h2></center>
			</c:if>
			<ul class="article-list">

				<c:forEach items="${categoryArticleInformations }" var="categoryArticleInformation">
					<c:if test="${!empty categoryArticleInformation.category }">
						<h3 style="clear: both; padding-top: 20px; margin-top: 0; margin-bottom: 0;">${categoryArticleInformation.category.name }</h3>
					</c:if>
					<c:forEach items="${categoryArticleInformation.articleInformations}" var="articleInformation">
						<li class="article" style="width: 48%; float: left; margin-right: 2%;">
							<div class="article-time">
								<span class="time">${articleInformation.time }</span>&nbsp;
								<a href="${root }/category?categoryId=${articleInformation.category.id }" class="title">${articleInformation.category.name }</a>
							</div> <a href="${root }/article/read/${articleInformation.article.id }" class="article-name">${articleInformation.article.title }</a>
							<div class="tags">
								<ul>
									<c:forEach var="tag" items="${articleInformation.tags }">
										<li><a href="${root }/tag?tagId=${tag.id}" class="tag" >${tag.name}</a></li>
									</c:forEach>
									<c:if test="${!empty username}">
									<li style="float: right; padding-top: 0px; padding-bottom: 0px;"><a class="tag"
											href="/" style="background-color: orangered; margin-right: 0px;">删除</a></li>
									<li style="float: right; padding-top: 0px; padding-bottom: 0px;"><a class="tag"
											href="${root}/manager/article/${articleInformation.article.id}" style="background-color: cornflowerblue; margin-right: 0px;">修改</a></li>
											</c:if>
								</ul>
							</div>
						</li>
					</c:forEach>
				</c:forEach>
			</ul>
		</div>
		<div style="clear: left; padding-top: 20px;"></div>
		<jsp:include page="../common/footer.jsp" flush="true" />

	</div>
	<a id="gotop" href="javascript:pageScroll()">
		<span class="glyphicon glyphicon-chevron-up"></span>
	</a>
</body>

</html>